const express = require('express')
const app = express()
const path = require('path')
require('./db')

// 引入addAdminRoute页面
const addAdminRoute = require('./route/addAdmin')
const adminListRoute = require('./route/adminList')
const deleteadminRoute = require('./route/deleteadmin')
const addAdvRoute = require('./route/addAdv')
const getAdvRoute = require('./route/advList')

app.use(express.urlencoded())
app.use(express.json())

// 暴露整个upload文件
app.use(express.static(path.resolve(__dirname,'./upload')))

app.use(addAdminRoute)
app.use(adminListRoute)
app.use(deleteadminRoute)
app.use(addAdvRoute)
app.use(getAdvRoute)

app.listen(6565, () => {
    console.log('服务器启动成功');
})